var t = require("../../../../@babel/runtime/helpers/interopRequireDefault")(require("../../../../utils/util.js")), a = getApp();

Page({
    data: {
        select: !1,
        is_name: "Auction",
        keyword: "",
        status: "1",
        page: 1,
        current_page: 1,
        last_page: 1,
        is_new: "",
        is_recommend: "",
        auctioneer_id: "",
        id: wx.getStorageSync("yz_uid"),
        password: ""
    },
    onLoad: function(t) {
        this.getSearch();
    },
    goshop: function(t) {
        var a = t.currentTarget.dataset.info.member_id;
        wx.navigateTo({
            url: "/packageD/auction/auctioneer-shop/auctioneer_shop/auctioneer_shop?id=" + a
        });
    },
    golist: function(t) {
        console.log(t);
        var a = t.currentTarget.dataset.info.goods_id, e = t.currentTarget.dataset.info.member_id;
        wx.navigateTo({
            url: "/packageD/auction/auction/auction_good/auction_good?id=" + a + "&member_id=" + e
        });
    },
    yanzhen: function(t) {
        console.log(t.currentTarget.dataset.info.member_id);
        var a = t.currentTarget.dataset.info, e = t.currentTarget.dataset.info.goods_id, o = t.currentTarget.dataset.info.member_id;
        1 == a.is_verify ? "1" == this.data.status ? wx.navigateTo({
            url: "/packageD/auction/auction/auction_good/auction_good?id=" + e + "&member_id=" + o
        }) : wx.navigateTo({
            url: "/packageD/auction/auctioneer-shop/auctioneer_shop/auctioneer_shop?id=" + e
        }) : this.setData({
            showone: !0,
            select_item: a,
            yanzGoodId: e,
            yanzMemberId: o
        });
    },
    is_password: function(t) {
        this.setData({
            password: t.detail.value
        });
    },
    isCoverLayer_passwork: function(t) {
        this.setData({
            showone: !1,
            password: ""
        });
    },
    confirm: function() {
        a._isTextEmpty(this.data.password) && wx.showToast({
            title: "title"
        });
        var t = {
            art: "verifyPassword",
            auction_id: this.data.select_item.member_id,
            passwd: this.data.password
        }, e = this, o = a.getNetAddresss("plugin.auction.api.index.getAuctionData");
        a._getNetWork({
            url: o,
            data: t,
            success: function(t) {
                var a = t.data;
                1 == a.result ? (e.setData({
                    showone: !1
                }), "1" == e.data.status ? wx.navigateTo({
                    url: "/packageD/auction/auction/auction_good/auction_good?id=" + e.data.yanzGoodId + "&member_id=" + e.data.select_item.member_id
                }) : wx.navigateTo({
                    url: "/packageD/auction/auctioneer-shop/auctioneer_shop/auctioneer_shop?id=" + e.data.select_item.member_id
                })) : wx.showToast({
                    title: a.msg,
                    icon: "none",
                    duration: 1e3
                });
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    selectTap: function() {
        this.setData({
            select: !this.data.select
        });
    },
    tapinput: function(t) {
        this.setData({
            keyword: t.detail.value
        });
    },
    nametap: function(t) {
        this.setData({
            is_name: t.currentTarget.dataset.name,
            select: !1,
            status: "Auction" == t.currentTarget.dataset.name ? "2" : "1",
            datas: [],
            page: 1,
            current_page: 1,
            last_page: 1
        }), this.getSearch();
    },
    gosearchIn: function() {
        console.log("点击搜索"), this.getSearch();
    },
    onReady: function() {},
    onShow: function() {
        this.getSearch();
    },
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        this.data.current_page >= this.data.last_page ? wx.showToast({
            title: "没有更多",
            duration: 1e3,
            icon: "none"
        }) : this.getMoreSearch();
    },
    onShareAppMessage: function() {},
    getMoreSearch: function() {
        var e = this, o = a.getNetAddresss("plugin.auction.api.index.getAuctionData"), s = {
            keyword: e.data.keyword,
            status: this.data.status,
            auc_status: "",
            is_new: "",
            is_recommend: "",
            auctioneer_id: "",
            art: "getSearch",
            page: this.data.page,
            is_pass: "1"
        };
        a._postNetWork({
            url: o,
            data: s,
            success: function(a) {
                var o = a.data;
                if (1 == o.result) {
                    if (0 == o.data.getSearch.data.length) return 1 == e.data.status ? wx.showToast({
                        title: "没有相关拍品",
                        icon: "none",
                        duration: 1e3
                    }) : 2 == e.data.status && wx.showToast({
                        title: "没有相关拍卖官",
                        icon: "none",
                        duration: 1e3
                    }), void e.setData({
                        datas: []
                    });
                    for (var s = 0; s < o.data.getSearch.data.length; s++) o.data.getSearch.data[s].end_shooting = t.default.formatTimeTwo(o.data.getSearch.data[s].end_shooting, "Y-M-D h:m:s");
                    e.setData({
                        datas: this.data.datas.concat(o.data.getSearch.data),
                        current_page: o.data.getSearch.current_page,
                        last_page: o.data.getSearch.last_page,
                        total: o.data.getSearch.total
                    });
                } else wx.showToast({
                    title: o.msg,
                    icon: "none",
                    duration: 1e3
                });
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    getSearch: function() {
        var e = this, o = a.getNetAddresss("plugin.auction.api.index.getAuctionData"), s = {
            keyword: e.data.keyword,
            status: this.data.status,
            auc_status: "",
            is_new: "",
            is_recommend: "",
            auctioneer_id: "",
            art: "getSearch",
            page: this.data.page,
            is_pass: "1"
        };
        a._postNetWork({
            url: o,
            data: s,
            success: function(a) {
                var o = a.data;
                if (1 == o.result) {
                    if (0 == o.data.getSearch.data.length) return 1 == e.data.status ? wx.showToast({
                        title: "没有相关拍品",
                        icon: "none",
                        duration: 1e3
                    }) : 2 == e.data.status && wx.showToast({
                        title: "没有相关拍卖官",
                        icon: "none",
                        duration: 1e3
                    }), void e.setData({
                        datas: []
                    });
                    for (var s = 0; s < o.data.getSearch.data.length; s++) o.data.getSearch.data[s].end_shooting = t.default.formatTimeTwo(o.data.getSearch.data[s].end_shooting, "Y-M-D h:m:s");
                    e.setData({
                        datas: o.data.getSearch.data,
                        current_page: o.data.getSearch.current_page,
                        last_page: o.data.getSearch.last_page,
                        total: o.data.getSearch.total
                    });
                } else wx.showToast({
                    title: o.msg,
                    icon: "none",
                    duration: 1e3
                });
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    getStatus: function() {
        var t = this, e = a.getNetAddresss("plugin.auction.api.index.getAuctionData"), o = {
            member_id: this.data.id
        };
        a._getNetWork({
            url: e,
            data: o,
            success: function(a) {
                var e = a.data;
                1 == e.result ? t.setData({
                    status: e.data.getVerify.status
                }) : wx.showToast({
                    title: res.msg,
                    icon: "none",
                    duration: 1e3
                });
            },
            fail: function(t) {
                console.log(t), wx.showToast({
                    title: t.msg,
                    icon: "none",
                    duration: 1e3
                });
            }
        });
    }
});